<?php
$adminProcess = "";
$obj = "\$object_$class";

$adminProcess .="<?php".$CR."include(\"../../config/config.php\");".$CR;

$adminProcess .="\$DM->loadClass(\"$package\",\"$class\");".$CR;
$adminProcess .="// create and instance class".$CR;
$adminProcess .=$obj." = new $class();".$CR;

for ($i=0;$i<count($var);$i++){
		$adminProcess .=$obj."->".$var[$i]["name"]." = array_key_exists(\"".$var[$i]["name"]."\",\$_POST)?\$_POST[\"".$var[$i]["name"]."\"]:\"\"; ".$CR;
}

$adminProcess .="if (".$obj."->save()){".$CR;
$adminProcess .="	header(\"Location: $class.list.php\");".$CR;
$adminProcess .="}else{".$CR;
$adminProcess .="	exit(\"Erro ao salvar $class\");".$CR;
$adminProcess .="}".$CR;

$adminProcess .="?>".$CR;

?>

